package com.ten.teacher.contorller;

import com.baomidou.mybatisplus.core.metadata.IPage;

import com.ten.common.core.entity.EduTeacher;
import com.ten.common.core.entity.TbCheckTeacher;
import com.ten.common.core.vo.Result;
import com.ten.teacher.service.TbCheckTeacherService;
import com.ten.teacher.vo.CheckStatusVo;
import com.ten.teacher.vo.CheckTeacherVo;
import com.ten.teacher.vo.CheckUpdateVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：Wqw
 * @date ：Created in 2022/12/7 18:01
 * @description：查询审核讲师列表的controller层
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/core/checkTeacher")
@Api(tags = "审核讲师列表API接口类")
public class TbCheckTeacherController {

    @Autowired
    private TbCheckTeacherService tbCheckTeacherService;

    /**
     * 查询审核讲师的列表，模糊查询，分页
     * page  页码数
     * limit 当前页面的行数
     * CheckTeacherVo 模糊查询的条件*/
    @ApiOperation(value ="查询审核讲师列表,模糊查询,分页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page",value = "当前页码数"),
            @ApiImplicitParam(name = "limit",value = "当前页显示行数"),
    })
    @PostMapping("/findTeacherCheck/{page}/{limit}")
    public Result<IPage<EduTeacher>> findTeacherCheck(@PathVariable(required = true) Integer page, @PathVariable(required = true) Integer limit,
                                                      @RequestBody CheckTeacherVo checkTeacherVo){
       return tbCheckTeacherService.getCheckTeacherByPage(page, limit, checkTeacherVo);
    }





    /**
     * 修改审核讲师信息
     * CheckUpdateVo*/
    /**修改讲师信息
     *CheckUpdateVo 条件类 */
    @PostMapping("/updateTeacherCheck")
    @ApiOperation(value = "修改审核的讲师信息")
    public Result<EduTeacher> updateTeacherCheck(@RequestBody CheckUpdateVo checkUpdateVo){
        return tbCheckTeacherService.updateTeacherById(checkUpdateVo);
    }

    /**
     * 审核讲师
     * 修改讲师的审核状态和讲师状态，启动状态（逻辑删除）
     * CheckVo 条件类*/
    @ApiOperation(value = "审核讲师，改变讲师的审核状态")
    @PostMapping("/changeTeacherCheck")
    public Result<EduTeacher> changeTeacherCheck(@RequestBody CheckStatusVo checkStatusVo){
        return tbCheckTeacherService.checkTeacherById(checkStatusVo);
    }


}
